package com.yl.demo.base.config.thymeleaf;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.*;

/**
 *
 * spring boot 配置静态资源扫描路径
 * spring boot对静态资源的默认扫描路径是：
 *
 * classpath:/static
 * classpath:/public
 * classpath:/resources
 * classpath:/META-INF/resources
 *
 * @author YL
 */
@Configuration
//@EnableWebMvc
public class myViewConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // super.addResourceHandlers(registry);
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }
}
